# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libexif
pkgver=0.6.22
pkgrel=0
pkgdesc="A library to parse an EXIF file and read the data from those tags"
url="https://sourceforge.net/projects/libexif"
arch="all"
license="LGPL-2.0-or-later"
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/libexif/libexif/releases/download/libexif-${pkgver//./_}-release/libexif-$pkgver.tar.xz"

# secfixes:
#   0.6.22-r0:
#     - CVE-2018-20030
#     - CVE-2020-13114
#     - CVE-2020-13113
#     - CVE-2020-13112
#     - CVE-2020-0093
#     - CVE-2019-9278
#     - CVE-2020-12767
#     - CVE-2016-6328
#   0.6.21-r3:
#     - CVE-2017-7544
#   0.6.21-r0:
#     - CVE-2012-2812
#     - CVE-2012-2813
#     - CVE-2012-2814
#     - CVE-2012-2836
#     - CVE-2012-2837
#     - CVE-2012-2840
#     - CVE-2012-2841
#     - CVE-2012-2845
#   0.6.19-r0:
#     - CVE-2009-3895

prepare() {
	default_prepare

	# The tarballs upstream provides uses /usr/bin/sh instead of /bin/sh
	# most likely as a result of a poor usrmerge
	grep -l '^#!/usr/bin/sh' -r . | xargs sed -i 's|^#!/usr/bin/sh|#!/bin/sh|g'
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}
sha512sums="0a9e7bf0258ed98a794b667d45e8fc65299101a2a2d2e39c358715b20b003beff258782f0736cd5b53978428a2f878a989f303bee249a978850a065f33c534af  libexif-0.6.22.tar.xz"
